//
//  SearchViewController.m
//  HuiPinZhiJia
//
//  Created by MS on 16/8/29.
//  Copyright © 2016年 MS. All rights reserved.
//

#import "SearchViewController.h"
#import "SuperNav.h"
@interface SearchViewController ()<UISearchBarDelegate>
@property (nonatomic,strong)UIBarButtonItem *cancelBtn;
@property (nonatomic,strong)UISearchBar *searchBar;
@end

@implementation SearchViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"搜索";
    
    self.view.backgroundColor = [UIColor colorWithRed:0.97 green:0.97 blue:0.97 alpha:1.00];
    
    [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:0.41 green:0.79 blue:1.00 alpha:1.00]];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],UITextAttributeFont : [UIFont boldSystemFontOfSize:18]}];
//   取消按键
    _cancelBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemStop target:self action:@selector(cancelBtn:)];
    [_cancelBtn setTintColor:[UIColor whiteColor]];
    self.navigationItem.rightBarButtonItem = _cancelBtn;
    
//搜索框
    _searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(5, 70, screenWidth - 10, 50)];
    _searchBar.delegate = self;
    _searchBar.barStyle = UISearchBarStyleDefault;
    _searchBar.barTintColor = [UIColor whiteColor];
    _searchBar.placeholder = @"请输入搜索关键词";
    _searchBar.layer.cornerRadius = 5;
    [self.view addSubview:_searchBar];
    // Do any additional setup after loading the view.
}

#pragma mark UISearchBarDelegate
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
    SLLog(@"你搜啥？");
}

- (void)cancelBtn:(id)sender
{
    self.tabBarController.selectedIndex = 0;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
